﻿using System;
using System.Collections.Generic;
using System.Linq;
using SqlSugar;
using System.Text;
using System.Threading.Tasks;
using WcsTask;

namespace WCS.Entity
{
    /// <summary>
    /// WCS任务实体
    /// </summary>
    [SugarTable("WCS_TASK_MAIN")]
    public class WcsTaskMain : WcsTaskCommon
    {
        public WcsTaskMain()
        {
            Id = Guid.NewGuid().ToString();
            Task_Code = ProcessingTaskMain.GenerateRandomCode("main");
            Task_State = 5;
            Task_Source = 1;
            Priority = 1;
            Split = 1;
            TaskTips = "初始创建";
            CreateTime = DateTime.Now;
        }

        /// <summary>
        /// 是否可以拆分
        /// </summary>
        public int Split { get; set; }

        /// <summary>
        /// 任务先后顺序
        /// </summary>
        public int Order { get; set; }

        /// <summary>
        /// 起始库位号
        /// </summary>
        public string StartWMSBinCode { get; set; }

        /// <summary>
        /// 工序类型
        /// </summary>
        public string ProcessType { get; set; }

        /// <summary>
        /// 终点库位号
        /// </summary>
        public string EndWMSBinCode { get; set; }

        /// <summary>
        /// 是否是给小车补空托的任务
        /// </summary>
        public string Replenishment { get; set; }

        /// <summary>
        /// 物料类型
        /// </summary>
        public string MaterialType { get; set; }

        /// <summary>
        /// 质检任务
        /// </summary>
        public string QualityTesting { get; set; }

        /// <summary>
        /// 继续生产
        /// </summary>
        public int ContinueProduction { get; set; }

        /// <summary>
        /// 兄弟任务
        /// </summary>
        public string brother { get; set; }

        /// <summary>
        /// 意向站台
        /// </summary>
        public string intentionStation { get; set; }

        /// <summary>
        /// 托盘1内容
        /// </summary>
        public string BarCode1Data { get; set; }

        /// <summary>
        /// 托盘2内容
        /// </summary>
        public string BarCode2Data { get; set; }

        /// <summary>
        /// 输送线
        /// </summary>
        public WcsTaskConveyor wcsTaskConveyor = new WcsTaskConveyor();

        /// <summary>
        /// 堆垛机
        /// </summary>
        public WcsTaskStacker wcsTaskStacker = new WcsTaskStacker();

        /// <summary>
        /// AGV
        /// </summary>
        public List<WcsTaskAGV> wcsTaskAGVs = new List<WcsTaskAGV>();
    }

    [SugarTable("WCS_ZBK_TASK_MAIN")]
    public class WcsZBKTaskMain : WcsTaskMain
    { }

    public enum Task_State
    {
        AGV任务下发 = 0,
        初始创建 = 5,
        等待执行 = 25,
        执行中 = 55,
        上报WMS任务完成 = 99,
        任务完成 = 100,
        任务取消 = 102,
    }

    public enum Task_Source
    {
        WCS自建任务 = 1,
        WMS下发任务 = 2,
    }

    public enum ProcessType
    {
        铸造到缓存区 = 1,
        缓存区到出库口到铸造 = 2,
        砂芯下线到入库口到缓存区 = 3,
        缓存区到制砂芯缓存区 = 4,
        缓存区到入库口到缓存区 = 5,
        出库口到砂芯缓存区 = 6,
        砂芯换车 = 7,
        砂芯缓存到制砂芯 = 8,
        质检到入库口到缓存区 = 9,
    }
}
